package io;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class PwDemo {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("pw2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw, true);
        pw.println("hello world");
        pw.println("hello world");
        pw.println("hello world");
        System.out.println("写出成功");
        pw.close();
    }
}
